package cn.zymall.goods.controller;

import cn.zymall.common.controller.crud.BaseController;
import cn.zymall.common.model.Kinds;
import cn.zymall.goods.service.KindsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lxh
 * @Description TODO
 * @date 2020/8/18 9:54
 * @Classname KindsController
 **/
@RestController
@RequestMapping("/kinds")
public class KindsController extends BaseController<KindsService, Kinds> {

	@Autowired
	private KindsService kindsService;

	/**
	 * 查询所有商品分类
	 * @return
	 */
	@GetMapping("/findAll")
	public List<Kinds> findAll() {
		return kindsService.findAll();
	}



	/**
	 * 添加商品分类
	 * @param kinds
	 */
	@PostMapping("/add")
	public void add(Kinds kinds){
		 kindsService.add(kinds);
	}

	/**
	 * 修改商品分类
	 * @param kinds
	 */
	@PostMapping("/amend")
	public void amend(Kinds kinds) {

		kindsService.amend(kinds);
	}

	@PostMapping("/del")
	public void del(Kinds kinds) {
		kindsService.del(kinds);
	}

	@GetMapping("/findAllKinds")
	public List<Kinds> findAllKinds() {
		return kindsService.findAllKinds();
	}

}
